package com.alpha.ioc.componentScan;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
public class EngineFactory {
    @Bean(name = "family")
    @Scope("prototype")
    Engine produceFamilyEngine(@Value("${engine.family}") Integer power) {
        System.out.println("engine leave the factory....");
        return new Engine(power);
    }

    @Bean(name = "sport")
    @Scope("prototype")
    Engine produceSportEngine(@Value("${engine.sport}") Integer power){
        return new Engine(power);
    }
}

